import { createRouter, createWebHashHistory } from 'vue-router'

// const App = () => import(/* webpackChuckName "app" */ '../App.vue')
const Analysis = () => import(/* webpackChunkName: "analysis" */ '../views/Analysis.vue')
const AttributeAnalysis = () => import(/* webpackChuckName: "attributeAnalysis" */ '../views/AttributeAnalysis.vue')
const FunnelAnalysis = () => import(/* webpackChuckName: "funnelAnalysis" */ '../views/FunnelAnalysis.vue')
const DataOverView = () => import(/* webpackChuckName "dataOverView" */ '../views/DataOverView.vue')
const UserDataOverView = () => import(/* webpackChuckName "userDataOverView" */ '../views/UserDataOverView.vue')
const ProductDataOverView = () => import(/* webpackChuckName "productDataOverView" */ '../views/ProductDataOverView.vue')
const Manage = () => import(/* webpackChuckName "Manage" */ '../views/manage.vue')
const DataAssets = () => import(/* webpackChuckName "DataAssetsView" */ '../views/DataAssets.vue')
const model = () => import(/* webpackChuckName "modelView" */ '../views/model.vue')
const KnowledgeDecision = () => import(/* webpackChuckName "knowledgeDecision" */ '../views/KnowledgeDecision.vue')
const DecisionLogic = () => import(/* webpackChuckName "decisionLogic" */ '../views/DecisionLogic.vue')
const FactComponent = () => import(/* webpackChuckName "factComponent" */ '../views/FactComponent.vue')
const KnowledgeName = () => import(/* webpackChuckName "knowledgeName" */ '../views/KnowledgeName.vue')
const Login = () => import('../views/login.vue')
const Register = () => import('../views/register.vue')
const Forget = () => import('../views/forget.vue')
const routes = [
  {
    path: '/',
    name: 'index',
    // component: App,
    redirect: '/dataOverView',
    children: [
      {
        path: '/login',
        name: 'login',
        component: Login,
      },
      {
        path: '/register',
        name: 'register',
        component: Register,
      },
      {
        path: '/forget',
        name: 'forget',
        component: Forget
      },
      {
        path: 'dataOverView',
        name: 'dataOverView',
        component: DataOverView,
        redirect: '/dataOverView/userData',
        children: [
          {
            path: 'userData',
            name: 'userData',
            component: UserDataOverView,
          },
          {
            path: 'productData',
            name: 'productData',
            component: ProductDataOverView,
          },
        ],
      },
      {
        path: 'analysis',
        name: 'analysis',
        component: Analysis,
        redirect: '/analysis/funnel',
        children: [
          {
            path: 'attribute',
            name: 'attributeAnalysis',
            component: AttributeAnalysis,
          },
          {
            path: 'funnel',
            name: 'funnelAnalysis',
            component: FunnelAnalysis,
          },

        ],
      },
      {
        path: 'manage',
        name: 'manage',
        component: Manage,
      },
      {
        path: 'dataAssets',
        name: 'dataAssets',
        component: DataAssets,
      },
      {
        path: 'model',
        name: 'model',
        component: model,
      },
      {
        path: 'decisionLogic',
        name: 'decisionLogic',
        component: DecisionLogic,
        redirect: '/decisionLogic/knowledgeName',
        children: [
          {
            path: 'factComponent',
            name: 'factComponent',
            component: FactComponent,
          },
          {
            path: 'knowledgeName',
            name: 'knowledgeName',
            component: KnowledgeName,
          },
          {
            path: 'knowledgeDecision',
            name: 'knowledgeDecision',
            component: KnowledgeDecision,
          },
        ],
      },
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router